import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
	import discusstravelguide from '@/views/modules/discusstravelguide/list'
	import foodclassification from '@/views/modules/foodclassification/list'
	import hotelclassification from '@/views/modules/hotelclassification/list'
	import storeinformation from '@/views/modules/storeinformation/list'
	import scenicspotclassification from '@/views/modules/scenicspotclassification/list'
	import personalorder from '@/views/modules/personalorder/list'
	import storeup from '@/views/modules/storeup/list'
	import foodinformation from '@/views/modules/foodinformation/list'
	import scenicspotinformation from '@/views/modules/scenicspotinformation/list'
	import discussscenicspothotels from '@/views/modules/discussscenicspothotels/list'
	import scenicspotreservation from '@/views/modules/scenicspotreservation/list'
	import travelguide from '@/views/modules/travelguide/list'
	import discussstoreinformation from '@/views/modules/discussstoreinformation/list'
	import chat from '@/views/modules/chat/list'
	import discussfoodinformation from '@/views/modules/discussfoodinformation/list'
	import discussscenicspotinformation from '@/views/modules/discussscenicspotinformation/list'
	import merchants from '@/views/modules/merchants/list'
	import user from '@/views/modules/user/list'
	import config from '@/views/modules/config/list'
	import scenicspothotels from '@/views/modules/scenicspothotels/list'


//2.配置路由   注意：名字
export const routes = [{
	path: '/',
	name: '系统首页',
	component: Index,
	children: [{
		// 这里不设置值，是把main作为默认页面
		path: '/',
		name: '系统首页',
		component: Home,
		meta: {icon:'', title:'center', affix: true}
	}, {
		path: '/updatePassword',
		name: '修改密码',
		component: UpdatePassword,
		meta: {icon:'', title:'updatePassword'}
	}, {
		path: '/pay',
		name: '支付',
		component: pay,
		meta: {icon:'', title:'pay'}
	}, {
		path: '/center',
		name: '个人信息',
		component: center,
		meta: {icon:'', title:'center'}
	}
	,{
		path: '/discusstravelguide',
		name: 'r旅游攻略',
		component: discusstravelguide
	}
	,{
		path: '/foodclassification',
		name: '美食分类',
		component: foodclassification
	}
	,{
		path: '/hotelclassification',
		name: '酒店分类',
		component: hotelclassification
	}
	,{
		path: '/storeinformation',
		name: '店铺信息',
		component: storeinformation
	}
	,{
		path: '/scenicspotclassification',
		name: '景点分类',
		component: scenicspotclassification
	}
	,{
		path: '/personalorder',
		name: '个人订单',
		component: personalorder
	}
	,{
		path: '/storeup',
		name: '我的收藏',
		component: storeup
	}
	,{
		path: '/foodinformation',
		name: '美食信息',
		component: foodinformation
	}
	,{
		path: '/scenicspotinformation',
		name: '景点信息',
		component: scenicspotinformation
	}
	,{
		path: '/discussscenicspothotels',
		name: '景区酒店',
		component: discussscenicspothotels
	}
	,{
		path: '/scenicspotreservation',
		name: '景点预约',
		component: scenicspotreservation
	}
	,{
		path: '/travelguide',
		name: '旅游攻略',
		component: travelguide
	}
	,{
		path: '/discussstoreinformation',
		name: '店铺信息',
		component: discussstoreinformation
	}
	,{
		path: '/chat',
		name: 'AI客服',
		component: chat
	}
	,{
		path: '/discussfoodinformation',
		name: '美食信息',
		component: discussfoodinformation
	}
	,{
		path: '/discussscenicspotinformation',
		name: '景点信息',
		component: discussscenicspotinformation
	}
	,{
		path: '/merchants',
		name: '商家',
		component: merchants
	}
	,{
		path: '/user',
		name: '用户',
		component: user
	}
	,{
		path: '/config',
		name: '轮播图管理',
		component: config
	}
	,{
		path: '/scenicspothotels',
		name: '景区酒店',
		component: scenicspothotels
	}
	]
	},
	{
		path: '/login',
		name: 'login',
		component: Login,
		meta: {icon:'', title:'login'}
	},
	{
		path: '/register',
		name: 'register',
		component: register,
		meta: {icon:'', title:'register'}
	},
	{
		path: '*',
		component: NotFound
	}
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
	mode: 'hash',
	/*hash模式改为history*/
	routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
export default router;
